﻿@model EmailAccountModel

@using Telerik.Web.Mvc.UI;
@Html.ValidationSummary(true)
@Html.HiddenFor(model => model.Id)
<table class="adminContent">
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(model => model.Email)
		</td>
		<td class="adminData">
			@Html.EditorFor(model => model.Email)
			@Html.ValidationMessageFor(model => model.Email)
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(model => model.DisplayName)
		</td>
		<td class="adminData">
			@Html.EditorFor(model => model.DisplayName)
			@Html.ValidationMessageFor(model => model.DisplayName)
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(model => model.Host)
		</td>
		<td class="adminData">
			@Html.EditorFor(model => model.Host)
			@Html.ValidationMessageFor(model => model.Host)
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(model => model.Port)
		</td>
		<td class="adminData">
			@Html.EditorFor(model => model.Port)
			@Html.ValidationMessageFor(model => model.Port)
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(model => model.Username)
		</td>
		<td class="adminData">
			@Html.EditorFor(model => model.Username)
			@Html.ValidationMessageFor(model => model.Username)
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(model => model.Password)
		</td>
		<td class="adminData">
			@Html.EditorFor(model => model.Password, null, new { htmlAttributes = new { value = Model.Password } })
			@Html.ValidationMessageFor(model => model.Password)
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(model => model.EnableSsl)
		</td>
		<td class="adminData">
			@Html.EditorFor(model => model.EnableSsl)
			@Html.ValidationMessageFor(model => model.EnableSsl)
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(model => model.UseDefaultCredentials)
		</td>
		<td class="adminData">
			@Html.EditorFor(model => model.UseDefaultCredentials)
			@Html.ValidationMessageFor(model => model.UseDefaultCredentials)
		</td>
	</tr>
	@if (Model.Id > 0)
	{
		<tr>
			<td colspan="2">
				<div class="admin-config-group">
					<div class="title">@T("Admin.Configuration.EmailAccounts.SendTestEmail")</div>
				</div>
			</td>
		</tr>
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.SendTestEmailTo)
			</td>
			<td class="adminData">
				@Html.EditorFor(model => model.SendTestEmailTo)
			</td>
		</tr>
		<tr>
			<td class="adminTitle"></td>
			<td class="adminData">
				<button type="submit" name="sendtestemail" value="sendtestemail" class="btn btn-secondary">
					<i class="fa fa-envelope"></i>
					<span>@T("Admin.Configuration.EmailAccounts.SendTestEmail.Button")</span>
				</button>
			</td>
		</tr>
	}
</table>

@if (Model.TestEmailShortErrorMessage.HasValue())
{
	<p>
		<div class="alert alert-danger">@Model.TestEmailShortErrorMessage</div>
		<pre>@Model.TestEmailFullErrorMessage</pre>
	</p>
}

